<template>
<!-- 这是案例详情介绍 -->
  <div id="details">
    <div class="details_content">
      <div class="details_title" :style="{background:'url('+details.img+') center center / cover no-repeat'}">
        <div class="title_background">
          <div class="title_logo">
            <topLogo></topLogo>
          </div>
          <div class="title_text" :class="['title_text', num ? 'title-box' : '']">{{details.title}}</div>
          <div class="title_icon">
            <div class="img_icon" >
              <div :class="['title_move', num ? 'title_move_animation1' : '']">
                <i class="icon iconfont icon-calendar"></i>
                <p>DATE</p>
              </div>
            </div>
            <div class="img_icon">
              <div :class="['title_move', num ? 'title_move_animation2' : '']">
                <i class="icon iconfont icon-Page-Size"></i>
                <p>SIZE</p>
              </div>
            </div>
            <div class="img_icon">
              <div :class="['title_move', num ? 'title_move_animation3' : '']">
                <i class="icon iconfont icon-route"></i>
                <p>LOCATION</p>
              </div>
              
            </div>
            <div class="img_icon">
              <div :class="['title_move', num ? 'title_move_animation4' : '']">
                <i class="icon iconfont icon-icon-img"></i>
                <p>PHOTO BY</p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="imgs" v-for="(item, index) in imglist" :key="index">
        <img v-lazy="item" alt="" @click="preview(item)" :showIndicators='false' :closeable='true' :class="[num ? 'img_move' : '']">
      </div>
    </div>
  </div>
</template>

<script>
import topLogo from "../../components/topLogo";
import { ImagePreview } from 'vant';  //图片预览
export default {
  data () {
    return {
      num: false, //是否添加类名
      className: 'sso',   // 类名
      details: {img: "http://47.112.6.89/public/upload/projects/e25aad8f398d5c3f5e158c5c5f5d411f.jpg", title: "筠州小镇花园商业体", },
      // 详情的图片
      imglist: [
        'http://47.112.6.89/public/upload/projects/a14ac0b8855b8c780b72136529697960.jpg', 
        'http://47.112.6.89/public/upload/projects/67ddc7a3199eb0aab2b00fd9b69a7d68.jpg', 
        'http://47.112.6.89/public/upload/projects/5c5cb10510b2d466c9fa17a188d7f896.jpg',
        'http://47.112.6.89/public/upload/projects/35b71cbba40864715bebfaa1e105cb36.jpg',
        'http://47.112.6.89/public/upload/projects/a14ac0b8855b8c780b72136529697960.jpg', 
        'http://47.112.6.89/public/upload/projects/67ddc7a3199eb0aab2b00fd9b69a7d68.jpg', 
        'http://47.112.6.89/public/upload/projects/5c5cb10510b2d466c9fa17a188d7f896.jpg',
        'http://47.112.6.89/public/upload/projects/35b71cbba40864715bebfaa1e105cb36.jpg',
      ],
      
    }
  },
  components: {
    topLogo,
    [ImagePreview.Component.name]: ImagePreview.Component,    // 图片预览
  },
  methods: {
    // 点击图片，打开预览
    preview(data) {
      ImagePreview({images:[data], showIndex:false, closeable: true, className: this.className});
    },
    // 添加动画效果
    effect() {
      this.num = true;
    },
  },
  beforeMount() {
    var _this = this;
    // 延迟0.1秒，添加动画类名
    setTimeout(function() {
      _this.effect();  //添加动画类名
    },100)
  },
  beforeDestroy() {
    this.num = false; //去掉添加动画类名
  },
}
</script>

<style lang="less" scoped>
#details {
  padding: 0px;
}
.details_content {
  padding-bottom: 100px;
}
.details_title {
  height: 410px;
  position: relative;
  .title_background {
    position: absolute;
    top: 0px;
    left: 0px;
    height: 100%;
    width: 100%;
    background-color: rgba(0,0,0,0.5);
  }
  .title_text {
    text-align: center;
    margin-top: 0px;
    color: white;
    font-size: 20px;
    opacity: 0;
  }
}
// 标题文字动画
.title-box {
  opacity: 1 !important;
  margin-top: 65px !important;
  transition-duration: 0.8s !important;
  transition-delay: 0.5s !important;
}
// 标题文字动画结束

.imgs {
  margin: 10px 10px;
  font-size: 0px;
  img {
    width: 100%;
    margin-top: 50px;
    opacity: 0;
  }
}
// 图片动画
.img_move {
  margin-top: 0px !important;
  opacity: 1 !important;
  transition-delay: 0.5s !important;
  transition-duration: 0.8s !important;
}
// 图片动画结束

.title_icon {
  padding: 0px 30px;
  font-size: 13px;
  position: absolute;
  bottom: 20px;
  left: 0px;
  width: calc(100% - 60px);
  .img_icon {
    color: rgba(255, 255, 255, 0.6);
    display: inline-block;
    width: 50%;
    text-align: center;
    margin-top: 40px;
    overflow: hidden;
    .title_move {
      margin-left: -100px;
      opacity: 0;
    }
    .icon {
      font-size: 25px;
    }
    p {
      margin-top: 5px;
    }
  }
}
/deep/ .sso {
  background-color: red !important;
  .van-image-preview__close-icon {
    font-size: 30px !important;
  }
}
/deep/ .van-image-preview__overlay {
  background-color: red;
}
/deep/ .van-overlay {
  background-color: red !important;
}
// icon图标动画
.title_move_animation1 {
  margin-left: 0px !important;
  opacity: 1 !important;
  transition-duration: 1s !important;
  transition-delay: 1s !important;
}
.title_move_animation2 {
  margin-left: 0px !important;
  opacity: 1 !important;
  transition-duration: 1s !important;
  transition-delay: 1.4s !important;
}
.title_move_animation3 {
  margin-left: 0px !important;
  opacity: 1 !important;
  transition-duration: 1s !important;
  transition-delay: 1.8s !important;
}
.title_move_animation4 {
  margin-left: 0px !important;
  opacity: 1 !important;
  transition-duration: 1s !important;
  transition-delay: 2.2s !important;
}
// icon图标动画结束
</style>